/*
 * @Author: your name
 * @Date: 2021-03-25 19:02:18
 * @LastEditTime: 2021-03-26 16:50:30
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \shop\training-group-5-warehouse\danshang-admin\mock\evalute\index.js
 */
// 模拟商品评价数据
const Mock = require("mockjs");

const data = Mock.mock({
    "list|20": [{
        "id": "@id",
        "timeSearch|1": ["0", "1", "2", "3", "4", "5"],
        "evaluateShow|1": [false, true],
        "shopInfor": "@ctitle(15,20)",
        "username": "@cname",
        "shopScore|1-1000": 1,
        "serviceScore|1-1000": 1,
        "evaluationContent": "@ctitle",
        "replyContent": [{ "title": "@ctitle", "imgUrl|1": ["@image(50x50,@color,@ctitle)", ""] }],
        "scoreTime": "@datetime"
    }]
});

module.exports = [
    {
        url: "/vue-element-admin/evalute",
        type: "get",
        response: config => {
            const {
                page = 1,
                limit = 20,
            } = config.query;

            const pageList = data.list.filter(
                (item, index) => index < limit * page && index >= limit * (page - 1)
            );

            return {
                code: 20000,
                data: {
                    items: pageList,
                    total: data.list.length
                }
            }
        }
    }
];
